package cevent.source.cloudcenter.business.controller.client;/**
 * Created by Cevent on 2021/7/16.
 */

import cevent.source.cloudcenter.server.dto.ResponseDataDto;
import cevent.source.cloudcenter.server.service.ModuleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author cevent
 * @description 客户端模块接口
 * @date 2021/7/16 11:16
 */

@RestController
@RequestMapping("/client/module")
public class ClientModuleController {
    private static final Logger LOG= LoggerFactory.getLogger(ClientModuleController.class);
    public static final String BUSINESS_NAME="客户端Module模块";

    @Resource
    private ModuleService moduleService;

    //首页信息接口:轮播图及核心信息
    @GetMapping("/getBaseModule")
    public ResponseDataDto getBaseModule(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getBaseModule());
        return responseData;
    }
    //素材中心：轮播素材
    @GetMapping("/material/carousel")
    public ResponseDataDto getCarouselMaterial(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCarouselMaterial());
        return responseData;
    }
    //获取视频分类：根据videoType查询分类list
    @PostMapping("/material/video/{videoType}")
    public ResponseDataDto getMaterialVideoByType(@PathVariable String videoType){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getMaterialVideoByType(videoType));
        return responseData;
    }
    //获取平面分类：根据planeType查询分类list
    @PostMapping("/material/plane/{planeType}")
    public ResponseDataDto getMaterialPlaneByType(@PathVariable String planeType){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getMaterialPlaneByType(planeType));
        return responseData;
    }
    //获取大记事分类：根据eventType查询分类list
    @PostMapping("/material/event/{eventType}/{eventDate}")
    public ResponseDataDto getMaterialEventBytType(@PathVariable String eventType,@PathVariable String eventDate){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getMaterialEventBytType(eventType,eventDate));
        return responseData;
    }
    //获取大事记日期
    @GetMapping("/material/event/date")
    public ResponseDataDto getMaterialEventDate(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getMaterialEventDate());
        return responseData;
    }
    //获取最新素材
    @PostMapping("/material/new/{videoType}")
    public ResponseDataDto getNewMaterial(@PathVariable String videoType){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getNewMaterial(videoType));
        return responseData;
    }
    //获取热门视频
    @GetMapping("/material/hot")
    public ResponseDataDto getHotMaterial(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getHotMaterial());
        return responseData;
    }

    //下载文件
    @PostMapping("/material/download/{uniId}/{suffix}")
    public void downloadMaterial(@PathVariable String uniId,@PathVariable String suffix,HttpServletResponse httpServletResponse) throws IOException {
        ResponseDataDto responseData=new ResponseDataDto();
        moduleService.downloadMaterial(uniId,suffix,httpServletResponse);
        responseData.setResponseData("下载素材成功!");
    }

    /**
     * 公司模块
     */
    //1.获取公司介绍页主图
    @GetMapping("/com/mainPic")
    public ResponseDataDto getCompanyMainPic(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCompanyMainPic());
        return responseData;
    }
    //2.获取公司介绍公司列表
    @GetMapping("/com/list")
    public ResponseDataDto getCompanyList(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCompanyList());
        return responseData;
    }
    //3.获取董事介绍列表
    @GetMapping("/com/chief/list")
    public ResponseDataDto getCompanyChiefList(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCompanyChiefList());
        return responseData;
    }
    //4.获取组织构架列表
    @GetMapping("/com/group/list")
    public ResponseDataDto getCompanyGroupList(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCompanyGroupList());
        return responseData;
    }
    //5.获取发展历程列表
    @GetMapping("/com/devhornor/list")
    public ResponseDataDto getCompanyDevhonorList(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCompanyDevhonorList());
        return responseData;
    }
    //荣誉资质
    @GetMapping("/com/hornor/list")
    public ResponseDataDto getCompanyHonorList(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCompanyHonorList());
        return responseData;
    }
    //6.轮循图接口
    @GetMapping("/com/recommend/list")
    public ResponseDataDto getCompanyRecommentList(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getCompanyRecommentList());
        return responseData;
    }
    
    /**关于我们：留言模块
     * */
    @GetMapping("/aboutUs")
    public ResponseDataDto getGuestBookBanner(){
        ResponseDataDto responseData=new ResponseDataDto();
        responseData.setResponseData(moduleService.getGuestBookBanner());
        return responseData;
    }
}
